<h1>Listing meals</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Price</th>
    <th>Products</th>
    <th>Created by</th>
  </tr>

<% for meal in @meals %>
  <tr>
    <td><%= link_to h(meal.name), meal %></td>
    <td><%= meal.price %></td>
    <td><%= meal.products.size %></td>
    <td><%= link_to h(meal.user.login), meal.user if meal.user %></td>
    <td><%= link_to 'Edit', edit_meal_path(meal) %></td>
    <td><%= link_to 'Destroy', meal, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New meal', new_meal_path %>
